-- drop table if exists jms_dwd.dwd_wide_customer_detail_incre_dt;

CREATE EXTERNAL TABLE jms_dwd.dwd_wide_customer_detail_incre_dt(
  waybill_no string COMMENT '运单号',
  ordersource_code string COMMENT '订单来源code',
  ordersource_name string COMMENT '订单来源',
  package_total_volume decimal(14,2) COMMENT '包裹总体积:单位立方厘米',
  package_volume double COMMENT '包裹体积',
  package_charge_weight decimal(14,2) COMMENT '包裹计费重量:单位千克',
  package_total_weight decimal(14,2) COMMENT '包裹总重量:单位千克',
  package_inside_charge_weight decimal(14,2) COMMENT '内部计费总重量:单位千克',
  taking_time string COMMENT '揽收时间',
  dispatch_time string COMMENT '派件时间',
  is_sign int COMMENT '是否签收',
  sign_time string COMMENT '签收时间',
  dispatch_network_code string COMMENT '派件网点code',
  dispatch_network_name string COMMENT '派件网点name',
  exception_code string COMMENT '异常原因编码',
  exception_name string COMMENT '异常原因',
  terminal_dispatch_code string COMMENT '三段码',
  is_abnormal smallint COMMENT '是否异常',
  problme_descs array<struct<problme_type_code:string,problme_scan_time:timestamp,proble_piece_status:int,problem_finish_duration:int>> comment '问题件信息',
  problme_to_void int COMMENT '问题件是否作废',
  is_void smallint COMMENT '运单是否作废',
  is_refund smallint COMMENT '是否退件',
  is_change_add int COMMENT '是否修改收件地址',
  change_add_apply_time string COMMENT '转寄时间',
  is_reback_tak int COMMENT '是否退回寄件网点',
  reback_tak_apply_time string COMMENT '退回寄件网点时间',
  customer_code string COMMENT '客户编码',
  customer_name string COMMENT '客户名称',
  customer_belong_network_id bigint COMMENT '客户所属网点id',
  customer_belong_network_name string COMMENT '客户所属网点名称',
  customer_signed_time string COMMENT '客户签约时间',
  customer_abbreviation string COMMENT '客户简称',
  customer_type_id bigint COMMENT '客户类型id',
  customer_type_name string COMMENT '客户类型名称',
  customer_country_id bigint COMMENT '客户所在国家id',
  customer_country_code string COMMENT '客户所在国家编码',
  customer_province_id bigint COMMENT '客户所在省份id',
  customer_city_id bigint COMMENT '客户所在城市id',
  customer_area_id bigint COMMENT '客户所在区县id',
  customer_province_desc string COMMENT '客户所在省份名字',
  customer_city_desc string COMMENT '客户所在城市名字',
  customer_area_desc string COMMENT '客户所在区县名字',
  customer_address string COMMENT '客户地址',
  customer_nature_id bigint COMMENT '客户性质id',
  customer_nature_name string COMMENT '客户性质名称',
  customer_settlement_id bigint COMMENT '结算方式id',
  customer_settlement_name string COMMENT '结算方式',
  customer_pay_id bigint COMMENT '客户支付方式id',
  customer_pay_type_name string COMMENT '客户支付方式',
  customer_source_id bigint COMMENT '客户来源id',
  customer_meter_bubble bigint COMMENT '计泡参数',
  customer_quote_id bigint COMMENT '客户报价方式id',
  customer_quote_name string COMMENT '客户报价方式',
  customer_account_period_id bigint COMMENT '账期类型id',
  customer_account_period_name string COMMENT '账期类型',
  customer_attribute_id int COMMENT '客户属性id',
  customer_attribute_name string COMMENT '客户属性',
  customer_category_primary_id bigint COMMENT '主营类目ID',
  customer_category_primary_name string COMMENT '主营类目名字',
  sender_province_id bigint COMMENT '发件省份id',
  sender_city_id bigint COMMENT '发件城市id',
  sender_area_id bigint COMMENT '发件区县id',
  sender_province_desc string COMMENT '发件省份名字',
  sender_city_desc string COMMENT '发件城市名字',
  sender_area_desc string COMMENT '发件区县名字',
  pick_network_code string COMMENT '寄件网点编码',
  pick_network_name string COMMENT '寄件网点名称',
  freight decimal(14,2) COMMENT '运费',
  total_freight decimal(14,2) COMMENT '总运费',
  receiver_province_id bigint COMMENT '收件省份id',
  receiver_city_id bigint COMMENT '收件城市id',
  receiver_area_id bigint COMMENT '收件区县id',
  receiver_province_desc string COMMENT '收件省份名字',
  receiver_city_desc string COMMENT '收件城市名字',
  receiver_area_desc string COMMENT '收件区县名字',
  waybill_is_business smallint COMMENT '是否商务件',
  waybill_is_receive smallint COMMENT '是否已收款',
  goods_type_code string COMMENT '快件物品类型编码',
  goods_type_name string COMMENT '快件物品类型名字',
  customer_order_time string COMMENT '客户下单时间',
  order_cancel_time string COMMENT '订单取消时间',
  order_status_code bigint COMMENT '订单状态code',
  order_status_name string COMMENT '订单状态名称',
  scantime_send string COMMENT '最早发件时间',
  instorage_time string COMMENT '最早入库时间',
  outstorage_time string COMMENT '最晚出库时间',
  is_end int COMMENT '问题件是否完结',
  is_exist_wayno int COMMENT '是否存在订单',
  order_input_time string COMMENT '订单录入时间',
  is_sign2 int COMMENT '备用字段')
COMMENT '客户运单宽表'
PARTITIONED BY (
  dt string COMMENT '分区字段 订单录入时间yyyy-mm-dd')
stored as parquet
LOCATION
  '/dw/hive/jms_dwd.db/external/dwd_wide_customer_detail_incre_dt'
TBLPROPERTIES (
'discover.partitions'='false',
'parquet.column.index.access'='true'
);
